package com.zatech.cgnci.project.base.enums;

import com.zatech.cgnci.project.base.exception.GlobalException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

/**
 * 操作类型枚举
 */
@AllArgsConstructor
@Getter
public enum OperationTypeEnum {
    TASK_ASSIGN("taskAssign", "任务分配"),
    TASK_TRANSFER("taskTransfer", "任务流转"),

    CREATE_CASE("createCase", "创建立案"),
    CANCEL_CASE("cancelCase", "案件注销"),
    SUBMIT_CASE("submitCase", "提交立案"),
    CASE_TASK_BACK("caseTaskBack", "立案任务审核退回"),
    CASE_TASK_PASS("caseTaskPass", "立案任务审核通过"),
    EDIT_CASE("editCase", "编辑案件信息"),
    EDIT_CONTACT("editContact", "编辑联络人信息"),
    SUBMIT_RESERVE("submitReserve", "提交准备金计提"),
    CANCEL_RESERVE("cancelReserve", "准备金计提注销"),
    RESERVE_TASK_BACK("reserveTaskBack", "准备金计提审核退回"),
    RESERVE_TASK_PASS("reserveTaskPass", "准备金计提审核通过"),
    SUBMIT_RESERVE_CHANGE("submitReserveChange", "提交准备金调整"),
    CANCEL_RESERVE_CHANGE("cancelReserveChange", "准备金调整注销"),
    RESERVE_CHANGE_TASK_BACK("reserveChangeTaskBack", "准备金调整审核退回"),
    RESERVE_CHANGE_TASK_PASS("reserveChangeTaskPass", "准备金调整审核通过"),
    SUBMIT_PREPAY("submitPrepay", "提交预付申请"),
    CANCEL_PREPAY("cancelPrepay", "预付申请注销"),
    PREPAY_TASK_BACK("prepayTaskBack", "预付申请审核退回"),
    PREPAY_TASK_PASS("prepayTaskPass", "预付申请审核通过"),
    SUBMIT_CASE_FINAL("submitCaseFinal", "提交结案申请"),
    CANCEL_CASE_FINAL("cancelCaseFinal", "结案申请注销"),
    CASE_FINAL_TASK_BACK("caseFinalTaskBack", "结案申请审核退回"),
    CASE_FINAL_TASK_PASS("caseFinalTaskPass", "结案申请审核通过"),
    SUBMIT_REOPEN("submitReopen", "提交重开申请"),
    CANCEL_REOPEN("cancelReopen", "重开申请注销"),
    REOPEN_TASK_BACK("reopenTaskBack", "重开申请审核退回"),
    REOPEN_TASK_PASS("reopenTaskPass", "重开申请审核通过"),
    ADD_INSURANCE_LIMIT("addInsurLimit", "新增险种最大净自留限额"),
    CANCEL_INSURANCE_LIMIT("cancelInsurLimit", "险种最大净自留限额任务注销"),
    SUBMIT_INSURANCE_LIMIT("submitInsurLimit", "险种最大净自留限额任务提交审核"),
    ADD_INSURANCE_LIMIT_BACK("addInsurLimitBack", "新增险种最大净自留限额任务审核退回"),
    ADD_INSURANCE_LIMIT_PASS("addInsurLimitPass", "新增险种最大净自留限额任务审核通过"),
    EDIT_INSURANCE_LIMIT("editInsurLimit", "编辑险种最大净自留限额"),
    CANCEL_EDIT_INSURANCE_LIMIT("cancelEditInsurLimit", "编辑险种最大净自留限额任务注销"),
    SUBMIT_EDIT_INSURANCE_LIMIT("submitEditInsurLimit", "编辑险种最大净自留限额任务提交审核"),
    EDIT_INSURANCE_LIMIT_BACK("editInsurLimitBack", "编辑险种最大净自留限额任务审核退回"),
    EDIT_INSURANCE_LIMIT_PASS("editInsurLimitPass", "编辑险种最大净自留限额任务审核通过"),
    CREATE_PROJECT("createProj", "新建项目"),
    CANCEL_CREATE_PROJECT("cancelCreateProj", "项目新建注销"),
    SUBMIT_CREATE_PROJECT("submitCreateProj", "项目新建提交审核"),
    CREATE_PROJECT_BACK("createProjBack", "项目新建审核退回"),
    CREATE_PROJECT_PASS("createProjPass", "项目新建审核通过"),
    INVALID_PROJECT("invalidProj", "作废项目"),
    CANCEL_INVALID_PROJECT("cancelInvalidProj", "项目作废注销"),
    SUBMIT_INVALID_PROJECT("submitInvalidProj", "项目作废提交审核"),
    INVALID_PROJECT_BACK("invalidProjBack", "项目作废审核退回"),
    INVALID_PROJECT_PASS("invalidProjPass", "项目作废审核通过"),
    ENTRY_POLICY("entryPolicy", "保单录入"),
    CANCEL_ENTRY_POLICY("cancelEntryPolicy", "保单录入注销"),
    SUBMIT_ENTRY_POLICY("submitEntryPolicy", "保单录入提交审核"),
    ENTRY_POLICY_BACK("entryPolicyBack", "保单录入审核退回"),
    ENTRY_POLICY_PASS("entryPolicyPass", "保单录入审核通过"),
    ENDO_POLICY("endoPolicy", "批改录入"),
    CANCEL_ENDO_POLICY("cancelEndoPolicy", "批改录入注销"),
    SUBMIT_ENDO_POLICY("submitEndoPolicy", "批改录入提交审核"),
    ENDO_POLICY_BACK("endoPolicyBack", "批改录入审核退回"),
    ENDO_POLICY_PASS("endoPolicyPass", "批改录入审核通过"),


    SUBMIT_REINSURANCE("submitReins", "预约临分/合约分入录入"),
    CANCEL_REINSURANCE("cancelReins", "预约临分/合约分入录入任务注销"),
    SUBMIT_REINSURANCE_AUDIT("submitReinsAudit", "预约临分/合约分入录入任务提交审核"),
    REINSURANCE_AUDIT_BACK("reinsAuditBack", "预约临分/合约分入录入任务审核退回"),
    REINSURANCE_AUDIT_PASS("reinsAuditPass", "预约临分/合约分入录入任务审核通过"),


    SUBMIT_REINSURANCE_CHANGE("submitReinsChange", "新增预约临分/合约分入批改录入"),
    CANCEL_REINSURANCE_CHANGE("cancelReinsChange", "预约临分/合约分入批改录入任务注销"),
    SUBMIT_REINSURANCE_CHANGE_AUDIT("submitReinsChangeAudit", "预约临分/合约分入批改录入任务提交审核"),
    REINSURANCE_CHANGE_AUDIT_BACK("reinsChangeAuditBack", "预约临分/合约分入批改录入任务审核退回"),
    REINSURANCE_CHANGE_AUDIT_PASS("reinsChangeAuditPass", "预约临分/合约分入批改录入任务审核通过"),


    SUBMIT_OUTGOING_CONTRACT("submitOutgoing", "分出合约录入"),
    CANCEL_OUTGOING_CONTRACT("cancelOutgoing", "分出合约录入注销"),
    SUBMIT_OUTGOING_CONTRACT_AUDIT("submitOutgoingAudit", "分出合约录入提交审核"),
    OUTGOING_CONTRACT_AUDIT_BACK("outgoingAuditBack", "分出合约录入审核退回"),
    OUTGOING_CONTRACT_AUDIT_PASS("outgoingAuditPass", "分出合约录入审核通过"),


    SUBMIT_OUTGOING_CONTRACT_CHANGE("submitOutgoingChange", "分出合约批改录入"),
    CANCEL_OUTGOING_CONTRACT_CHANGE("cancelOutgoingChange", "分出合约批改录入注销"),
    SUBMIT_OUTGOING_CONTRACT_CHANGE_AUDIT("submitOutgoingChangeAudit", "分出合约批改录入提交审核"),
    OUTGOING_CONTRACT_CHANGE_AUDIT_BACK("outgoingChangeAuditBack", "分出合约批改录入审核退回"),
    OUTGOING_CONTRACT_CHANGE_AUDIT_PASS("outgoingChangeAuditPass", "分出合约批改录入审核通过"),


    SUBMIT_REINSURANCE_COMPANY("submitReinsComp", "新增再保公司"),
    CANCEL_REINSURANCE_COMPANY("cancelReinsComp", "新增再保公司任务注销"),
    SUBMIT_REINSURANCE_COMPANY_AUDIT("submitReinsCompAudit", "新增再保公司任务提交审核"),
    REINSURANCE_COMPANY_AUDIT_BACK("reinsCompAuditBack", "新增再保公司任务审核退回"),
    REINSURANCE_COMPANY_AUDIT_PASS("reinsCompAuditPass", "新增再保公司任务审核通过"),


    SUBMIT_EDIT_REINSURANCE_COMPANY("submitEditReinsComp", "编辑再保公司"),
    CANCEL_EDIT_REINSURANCE_COMPANY("cancelEditReinsComp", "编辑再保公司任务注销"),
    SUBMIT_EDIT_REINSURANCE_COMPANY_AUDIT("submitEditReinsCompAudit", "编辑再保公司任务提交审核"),
    EDIT_REINSURANCE_COMPANY_AUDIT_BACK("editReinsCompAuditBack", "编辑再保公司任务审核退回"),
    EDIT_REINSURANCE_COMPANY_AUDIT_PASS("editReinsCompAuditPass", "编辑再保公司任务审核通过");


    public String code;
    public String desc;

    public static OperationTypeEnum getEnumByCode(String code) {
        return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findAny()
                .orElse(null);
    }
    public static String getEnumDescByCode(String code){
        OperationTypeEnum enumByCode = getEnumByCode(code);
        return enumByCode==null?null:enumByCode.getDesc();
    }

}
